use std::ops::Deref;

use serde::{Deserialize, Serialize};

use crate::error::AppErr;


pub mod online;
pub mod req;
pub mod res;


#[derive(Deserialize, Serialize)]
#[repr(transparent)]
pub struct Cbor<T>(pub T);

impl <T> Deref for Cbor<T> {
    type Target = T;
    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

pub struct Void;

pub type CborRet<T> = Result<Cbor<T>, AppErr>;

#[inline(always)]
pub fn cbor_ok<T>(value: T) -> CborRet<T> {
    Ok(Cbor(value))
}


